.btn {
  position: relative;
  display: inline-block;
  font-weight: $btn-font-weight;
  line-height: $btn-line-height;
  color: $body-color;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
  background-image: none;
  border: $btn-border-width solid transparent;
  @include button-size(
    $btn-padding-y,
    $btn-padding-x,
    $btn-font-size,
    $border-radius
  );
  box-shadow: $btn-box-shadow;
  cursor: pointer;
  transition: $btn-transition;
  //& 表示嵌套的上一级,代表上一级选择器
  &.disabled,
  &[disabled] {
    cursor: not-allowed;
    opacity: $btn-disabled-opacity;
    box-shadow: none;
    > * {
      pointer-events: none;
    }
  }
  &:focus {
    outline: 1px dotted;
  }
  &:active {
    transform: scale(0.95);
    animation: flash 0.5s linear;
  }
}
@keyframes flash {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.btn-lg {
  @include button-size(
    $btn-padding-y-lg,
    $btn-padding-x-lg,
    $btn-font-size-lg,
    $btn-border-radius-lg
  );
}
.btn-sm {
  @include button-size(
    $btn-padding-y-sm,
    $btn-padding-x-sm,
    $btn-font-size-sm,
    $btn-border-radius-sm
  );
}

.btn-primary {
  @include button-style($primary, $primary, $white);
}
.btn-danger {
  @include button-style($danger, $danger, $white);
}
.btn-dashed {
  @include button-style($white, $gray-400, $body-color);
  border: 1px dashed #000;
}
.btn-text {
  @include button-style($white, $gray-400, $body-color);
  border: 0;
  box-shadow: none;
  &:focus {
    border: 0;
    outline: none;
  }
  &:hover {
    border: 0;
    outline: none;
    background-color: rgba(0, 0, 0, 0.06);
  }
  &:active {
    border: 0;
  }
}
.btn-default {
  @include button-style(
    $white,
    $gray-400,
    $body-color,
    $white,
    $primary,
    $primary
  );
}

.btn-circle {
  border-radius: 50%;
}
.btn-round {
  border-radius: 50px;
}
.btn-block {
  width: 100%;
}
.btn-ghost {
  background-color: transparent; /* 使按钮背景透明 */
  transition:
    background-color 0.3s,
    color 0.3s; /* 添加过渡效果 */
}
.btn-link {
  font-weight: $font-weight-normal;
  color: $btn-link-color;
  text-decoration: $link-decoration;
  box-shadow: none;
  &:hover {
    color: $btn-link-hover-color;
    text-decoration: $link-hover-decoration;
  }
  &:focus,
  &.focus {
    text-decoration: $link-hover-decoration;
    box-shadow: none;
  }
  &:disabled,
  &.disabled {
    color: $btn-link-disabled-color;
    pointer-events: none;
  }
}
